package com.scrx.ymg.service.address;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.scrx.ymg.dao.address.IAddressDao;
import com.scrx.ymg.entity.Address;
import com.scrx.ymg.entity.User;

@Service("addressService")
public class AddressServiceImpl implements IAddressService {
     
	@Autowired
	private IAddressDao addDao;
	
    /**
     * 保存地址
     */
	public String save(Address add) {
		return addDao.save(add);
	}
	
	public List<Address> getAddress(String userID){
		
		return addDao.getAddress(userID);
	}


	public Address getAddressByID(String addID) {

		 return addDao.getAddressByID(addID);
	}


	public Address getAddress(String userID, String superID) {
		
		return addDao.getAddress(userID, superID);
	}


	public String deleteAddress(String addId) {
		Address add = addDao.getAddressByID(addId);
		return addDao.deleteAddress(add);
	}


	public List<Address> getAllAddress(String userID) {
		return addDao.getAllAddress(userID);
	}


	public String saveAddressAndUpdateUser(Address add, User user) {

		return addDao.saveAddressAndUpdateUser(add,user);
	}
    
	


}
